﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using Microsoft.Win32;
using System.IO;

namespace WpfTestApplication
{
    /// <summary>
    /// Interaction logic for OpenFileDialogTestWindow.xaml
    /// </summary>
    public partial class SaveFileDialogTestWindow : Window
    {
        public SaveFileDialogTestWindow()
        {
            InitializeComponent();
        }

        private void btnSaveFile_Click(object sender, RoutedEventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();
            if (sfd.ShowDialog().Value)
            {
                File.WriteAllText(sfd.FileName, txtText.Text);
            }
        }

        private void btnSaveFileTitle_Click(object sender, RoutedEventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog{ Title = "Save my file" };
            if (sfd.ShowDialog().Value)
            {
                File.WriteAllText(sfd.FileName, txtText.Text);
            }
        }
    }
}
